<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
     <script crossorigin src="https://unpkg.com/react@18/umd/react.development.js"></script>
    <script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>
    <script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
</head>
<body>
      <div id="root"></div>
     <script type="text/babel">
        class Root extends React.Component
        {
            constructor()
            {
                 super();
                 this.state = {
                    counter:0
                 }

                 this.Increment = this.Increment.bind(this);
                 this.Decrement = this.Decrement.bind(this);
            }

            render()
            {
                return (
                       <div>
                        <div>{this.state.counter}</div>
                        <button onClick = {this.Increment}>+1</button>
                        <button onClick = {this.Decrement}>-1</button>
                        </div>
                       )
            }


            Increment()
            {
                this.setState({
                    counter:this.state.counter+1
                })
            }

            Decrement()
            {
                this.setState({
                    counter:this.state.counter-1
                })
            }
        }
        const root = ReactDOM.createRoot(document.querySelector("#root"));
        root.render(<Root/>);
     </script>
</body>
</html>